// Kony

#pragma once

#include "CoreMinimal.h"
#include "Abilities/Tasks/AbilityTask.h"
#include "TargetDataUnderMouse.generated.h"

//广播鼠标目标数据向量值
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMounseTargetDataSignature, const FGameplayAbilityTargetDataHandle&, DataHandle);

/**
 * 鼠标瞄准的目标数据
 */
UCLASS()
class GASC_HUANLING_API UTargetDataUnderMouse : public UAbilityTask
{
	GENERATED_BODY()
public:
	//创建鼠标瞄准的目标数据
	UFUNCTION(BlueprintCallable, Category = "Ability|Tasks", meta = (DisplayName="TargetDataUnderMouse",HidePin = "OwningAbility", DefaultToSelf = "OwningAbility", BlueprintInternalUseOnly = "TRUE"))
	static UTargetDataUnderMouse* CreateTargetDataUnderMounse(UGameplayAbility* OwningAbility);

	//广播数据委托
	UPROPERTY(BlueprintAssignable)
	FMounseTargetDataSignature ValidData;

private:
	//激活事件
	virtual void Activate() override;
	//送目标数据，同时会发送给服务器
	void SendMouseCursorData();

	//这个是用于服务器监听客户端数据回调函数
	void OnTargetDataReplicatedCallback(const FGameplayAbilityTargetDataHandle& DataHandle, FGameplayTag ActivationTag);
};
